#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const int N = 70 + 5;
int t, n;
int a[N];

struct Point {
    int x;
    int y;
    Point() : x(0), y(0) {}
    Point(int a, int b) : x(a), y(b) {}
};

int maxPoints(vector<Point>& points) {
    int n = points.size();
    if (n == 0) return 0;
    else if (n == 1) return 1;
    int max_value = 0;
    for (int i = 0;i < n;i++) {
        int repeat = 0;
        int vertical = 0;
        map<double, int> mp;
        int curmax = 1;
        for (int j = 0;j < n;j++) {
            if (i != j) {
                double delta_x = points[j].x - points[i].x;
                double delta_y = points[j].y - points[i].y;
                if (delta_y == 0 && delta_x == 0) {
                    repeat += 1;

                }
                else if (delta_x == 0) {
                    if (vertical == 0)
                        vertical = 2;
                    else {
                        vertical += 1;
                    }
                    curmax = max(vertical, curmax);
                }
                else {
                    double k = delta_y / delta_x;
                    if (mp[k] == 0) {
                        mp[k] = 2;
                        curmax = max(mp[k], curmax);
                    }
                    else {
                        mp[k] += 1;
                        curmax = max(mp[k], curmax);
                    }
                }
            }
        }
        max_value = max(max_value, curmax + repeat);
    }
    return max_value;
}

int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    cin >> t;

    while (t--) {
        vector<Point> p;
        cin >> n;

        for (int i = 0; i < n; i++) {
            cin >> a[i];
            p.push_back(Point(i, a[i]));
        }

        cout << n - maxPoints(p) << endl;
    }
    return 0;
}